-
Notifications
You must be signed in to change notification settings - Fork 3.9k
xds: Changes to XdsClient Watcher APIs #12446
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
kannanjgithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sending what I could review today.
| * Called to deliver a transient error that should not affect the watcher's use of any | ||
| * previously received resource. | ||
| * | ||
| * <p>Note that we expect that the implementer to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment now applies to both methods since both methods take Status argument now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove it from the method's Javadoc as you have put in the class' Javadoc.
| type, resource); | ||
| respTimer = null; | ||
| onAbsent(null, activeCpc.getServerInfo()); | ||
| respTimer = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why swap the order of these statements?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original code was setting respTimer = null before calling onAbsent(), which caused the timeout context to be lost, resulting in a generic "does not exist" error.
The original for onAbsent method did not have a check for if (respTimer == null). It only looked at the serverInfo.resourceTimerIsTransientError() flag to decide between calling watcher.onError() or watcher.onResourceDoesNotExist(). It could not distinguish between a timeout and other "not found" conditions.
| logger.log(XdsLogLevel.WARNING, "No working fallback XDS Servers found from {0}", | ||
| activeCpClient.getServerInfo().target()); | ||
| activeCpc.getServerInfo().target()); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes above here seem unnecessary?
| executor.execute(() -> { | ||
| try { | ||
| notifyWatcher(watcher, data); | ||
| watcher.onResourceChanged(update); // Call the new method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the comment as we are passing StatusOr argument.
| continue; | ||
| } | ||
| if (subscriber.hasResult()) { | ||
| subscriber.onError(status, null); // This will become an onAmbientError |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the handling to call either onDataChanged or onAmbientError happens in ResourceSubscriber.onError, why not simply call it? You are only calling if subscriber.hasResult() is true. What if when it is false? Previously the onError was getting called in that case but not now.
kannanjgithub
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review comments.
| * Called to deliver a transient error that should not affect the watcher's use of any | ||
| * previously received resource. | ||
| * | ||
| * <p>Note that we expect that the implementer to: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove it from the method's Javadoc as you have put in the class' Javadoc.
| if (!Objects.equals(oldData, data)) { | ||
| for (ResourceWatcher<T> watcher : watchers.keySet()) { | ||
| StatusOr<T> update = StatusOr.fromValue(data); | ||
| for (Map.Entry<ResourceWatcher<T>, Executor> entry : watchers.entrySet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change from iterating the keySet to iterating the entrySet? There is nothing wrong with it but it seems like an unnecessary change.
Can keep the executor inlined like before as well.
|
|
||
| Status status; | ||
| if (respTimer == null) { | ||
| status = Status.NOT_FOUND.withDescription("Resource " + resource + " does not exist"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For resource deletions, if fail_on_data_error is false, we should not be setting data = null; and should be calling onAmbientError(NOT_FOUND). lastError should also be set to NOT_FOUND so both the data and the last error are available for replay for new watchers.
Only for fail_on_data_error true we should drop the resource (data = null;) and call onResourceChanged.
| for (Map<String, ResourceSubscriber<? extends ResourceUpdate>> subscriberMap : | ||
| resourceSubscribers.values()) { | ||
| for (ResourceSubscriber<? extends ResourceUpdate> subscriber : subscriberMap.values()) { | ||
| if (subscriber.hasResult() || !authoritiesForClosedCpc.contains(subscriber.authority)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove subscriber.hasResult()?
| private StatusOr<T> data; | ||
| @Nullable | ||
| @SuppressWarnings("unused") | ||
| private Status ambientError; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will there be a separate PR for propagating this to the data plane rpc error?
| } | ||
|
|
||
| if (!pendingRds.isEmpty()) { | ||
| // filter chain state has not yet been applied to filterChainSelectorManager and there |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore this comment.
Implements https://github.com/grpc/proposal/blob/master/A88-xds-data-error-handling.md#a88-xds-data-error-handling